﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace WPFModel.Data
{
    public class Book : INotifyPropertyChanged
    {
        public Book(string title, string publisher, string isbn)
        {
            this.标题 = title;
            this.出版社 = publisher;
            this.ISBN = isbn;
        }
        public Book()
            : this("未知", "未知", "未知")
        {
        }
        private string _title;

        public string 标题
        {
            get
            {
                return _title;
            }

            set
            {
                _title = value;
                if (PropertyChanged != null)
                    PropertyChanged(this, new PropertyChangedEventArgs("标题"));
            }
        }
        private string _publisher;
        public string 出版社
        {
            get
            {
                return _publisher;
            }
            set
            {
                _publisher = value;
                if (PropertyChanged != null)
                    PropertyChanged(this, new PropertyChangedEventArgs("出版社"));
            }
        }
        private string _isbn;
        public string ISBN
        {
            get
            {
                return _isbn;
            }
            set
            {
                _isbn = value;
                if (PropertyChanged != null)
                    PropertyChanged(this, new PropertyChangedEventArgs("ISBN"));
            }
        }
        private readonly List<string> authors = new List<string>();
        public string[] 作者集
        {
            get
            {
                return authors.ToArray();
            }
        }
        public override string ToString()
        {
            return 标题;
        }
        public event PropertyChangedEventHandler PropertyChanged;

    }
}
